package cn.glow.readingcloud.book.controller;


import cn.glow.readingcloud.book.service.CategoryService;
import cn.glow.readingcloud.common.result.Result;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pojo.CategoryView;

/**
 * @Author Glow
 * @Date 2023-04-15 22:46:15
 * @Description 图书分类接口
 * @Version 1.0
 */
@RestController
@RequestMapping("category")
@Api("图书分类信息查询接口")
public class CategoryController {
    @Autowired
    private CategoryService categoryService;
    @ApiOperation(value = "查询图书分类代码详细信息" , httpMethod = "GET")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "dicType", value = "图书类别ID", dataType = "String"),
            @ApiImplicitParam(paramType = "query", name = "code", value = "图书分类ID", dataType = "Integer")
    })
    @ApiResponses({@ApiResponse(code = 200, message = "", response = CategoryView.class)})
    @GetMapping("/getCategoryDetail")
    public Result<CategoryView> getCategoryDetail(String dicType, Integer code){

        return  categoryService.getDicTypeNameAndCodeName(dicType, code);
    }
}
